<template>
  <div class='container'>
        <el-dialog
      title="题目审核"
      :visible='checkVisible'
      width="50%"
      center
      :before-close="close"
      >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item>
          <el-radio-group v-model="form.chkState">
            <el-radio label='1'>通过</el-radio>
            <el-radio label='2'>拒绝</el-radio>
          </el-radio-group>
        </el-form-item>
       <el-form-item label="审核意见">
          <el-input type="textarea" v-model="form.chkRemarks"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitCheck">确认</el-button>
          <el-button @click="close">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  props: {
    checkId: {
      required: true
    },
    checkVisible: {
      type: Boolean,
      required: true
    }
  },
  data () {
    return {
      form: {
        chkState: '1',
        chkRemarks: ''
      }
    }
  },
  methods: {
    close () {
      this.$emit('closeCheck')
    },
    // 审核意见
    submitCheck () {
      console.log(123)
      if (this.form.chkRemarks.trim() === '') {
        return this.$message.warning('请输入审核意见')
      }
      console.log(456)
      choiceCheck({ id: this.checkId, ...this.form, chkState: parseInt(this.form.chkState) })
        .then(({ data }) => {
          console.log(data)
          this.$message.success('审核成功')
          this.close()
        })
    }
  }
}
</script>

<style scoped lang='less'></style>
